﻿@model List<BusinessClasses.SubCategoryTableModel>
@{
    Layout = null;
    ViewBag.Title = "ShowSubCategoryTable";
}


<table class="table table-striped table-hover table-bordered " id="tblSubCategoryGrid" cellspacing="0" width="100%">
    <thead>
        <tr>
            <th class="TextAlign">#</th>
            <th class="TextAlign">SubCategory Name</th>
            <th class="TextAlign">Category Name</th>
            <th class="TextAlign">Status</th>
            <th class="TextAlign">Remark</th>
            <th class="TextAlign">Actions</th>

        </tr>
    </thead>
    <tbody>
        @{   var count = 1;}
        @foreach (var subCategory in Model)
        {

            var classInfo = subCategory.SubCategoryShowing ? "success" : "danger";
            var remark =(!subCategory.IsCategoryActive?"Parent Category Not Selected":(!subCategory.IsCategoryVisible) ? "Parent Category not set for Showing" :(!subCategory.IsVisible ? "Not selected for showing." : "-"));
            
            <tr class="@classInfo">
                <td class="TextAlign RowTextCss">@count</td>
                <td class="TextAlign RowTextCss">@subCategory.SubCategoryName</td>
                <td class="TextAlign RowTextCss">@subCategory.CategoryName</td>
                <td class="TextAlign RowTextCss">@(subCategory.IsVisible && subCategory.IsCategoryVisible ? "Showing" : "Not Showing")</td>
                <td class="TextAlign RowTextCss">@remark</td>
                <td class="TextAlign">

                    <a class="AnchorCssRemove" data-toggle="modal" data-target="#popup" data-whatever="Anchor" data-subcategoryid="@subCategory.SubCategoryId">
                        <img class="ActionImages" src="~/Content/Images/Edit.png" />
                    </a>
                    <a class="AnchorCssRemove" style="margin-left: 2px" onclick="RemoveSubCategory(@subCategory.SubCategoryId)"><img class="ActionImages" src="~/Content/Images/Delete.png" /></a>
                </td>
            </tr>

            count++;
        }


    </tbody>
</table>


